package com.frxuexi.park2301.my

import androidx.databinding.DataBindingUtil
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.frxuexi.lib_base.entity.MyHistoryBean
import com.frxuexi.park2301.R
import com.frxuexi.park2301.databinding.ItemMyaskBinding

class MyApplyAdapter:BaseQuickAdapter<MyHistoryBean,BaseViewHolder>(R.layout.item_myask) {
    override fun onItemViewHolderCreated(viewHolder: BaseViewHolder, viewType: Int) {
        super.onItemViewHolderCreated(viewHolder, viewType)
        DataBindingUtil.bind<ItemMyaskBinding>(viewHolder.itemView)
    }
    override fun convert(helper: BaseViewHolder, item: MyHistoryBean) {
        val binding = DataBindingUtil.getBinding<ItemMyaskBinding>(helper.itemView)
        binding?.bean=item
        binding?.historyStatus?.apply {
            when(item.status){//0-未巡检、1-巡检中、2-已完成、3-已作废
                "待审核","已占用","待处理","未巡检"->setTextColor(context.resources.getColor(R.color.orange))
                "已通过","空闲","已完成"->setTextColor(context.resources.getColor(R.color.green))
                "已拒绝","维护中","处理中"->setTextColor(context.resources.getColor(R.color.redfont))
                "已作废"->setTextColor(context.resources.getColor(R.color.grayfont))
            }
        }

    }
}